package com.ibm.sample.library.web.action;

import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import com.ibm.sample.library.service.IService;
import com.opensymphony.xwork2.ActionSupport;

@ParentPackage("json-default")
@Result(name = "success", type = "json", params = { "root", "id" })
public class DeleteCategoryAction extends ActionSupport
{
    private static final long serialVersionUID = 1L;

    @Autowired
    private IService service;

    private long id;

    @Override
    public String execute() throws Exception
    {
        service.deleteCategoryById(id);

        return SUCCESS;
    }

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }
}
